#include <iostream>

// 模板元编程计算阶乘
template <int N>
struct Factorial {
    static const int value = N * Factorial<N - 1>::value;
};

// 特化模板，定义0的阶乘为1
template <>
struct Factorial<0> {
    static const int value = 1;
};

int main() 
{
    // 在编译时计算阶乘
    const int result = Factorial<5>::value;

    // 输出结果
    std::cout << "Factorial of 5 is: " << result << std::endl;

    return 0;
}
